package com.example.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HomeController {

    @GetMapping("/")
    @ResponseBody
    public String home() {
        return "\n" +
                "\u003c!DOCTYPE html\u003e\n" +
                "\u003chtml\u003e\n" +
                "\u003chead\u003e\n" +
                "    \u003ctitle\u003eJava后端示例页面\u003c/title\u003e\n" +
                "    \u003cstyle\u003e\n" +
                "        body {\n" +
                "            font-family: Arial, sans-serif;\n" +
                "            margin: 0;\n" +
                "            padding: 20px;\n" +
                "            background-color: #f5f5f5;\n" +
                "        }\n" +
                "        .container {\n" +
                "            max-width: 800px;\n" +
                "            margin: 0 auto;\n" +
                "            background-color: white;\n" +
                "            padding: 40px;\n" +
                "            border-radius: 8px;\n" +
                "            box-shadow: 0 2px 4px rgba(0,0,0,0.1);\n" +
                "        }\n" +
                "        h1 {\n" +
                "            color: #333;\n" +
                "        }\n" +
                "        p {\n" +
                "            color: #666;\n" +
                "            line-height: 1.6;\n" +
                "        }\n" +
                "        .info {\n" +
                "            background-color: #e8f4f8;\n" +
                "            padding: 15px;\n" +
                "            border-left: 4px solid #3498db;\n" +
                "            margin-top: 20px;\n" +
                "        }\n" +
                "    \u003c/style\u003e\n" +
                "\u003c/head\u003e\n" +
                "\u003cbody\u003e\n" +
                "    \u003cdiv class=\"container\"\u003e\n" +
                "        \u003ch1\u003e欢迎使用Java后端示例项目\u003c/h1\u003e\n" +
                "        \u003cp\u003e这是一个基于Spring Boot的简单Java后端应用。\u003c/p\u003e\n" +
                "        \u003cdiv class=\"info\"\u003e\n" +
                "            \u003cp\u003e项目信息：\u003c/p\u003e\n" +
                "            \u003cul\u003e\n" +
                "                \u003cli\u003e框架：Spring Boot\u003c/li\u003e\n" +
                "                \u003cli\u003e构建工具：Maven\u003c/li\u003e\n" +
                "                \u003cli\u003e运行端口：8080\u003c/li\u003e\n" +
                "            \u003c/ul\u003e\n" +
                "        \u003c/div\u003e\n" +
                "    \u003c/div\u003e\n" +
                "\u003c/body\u003e\n" +
                "\u003c/html\u003e\n";
    }

    @GetMapping("/api/hello")
    @ResponseBody
    public String helloApi() {
        return "{\"message\": \"Hello from Java Backend!\"}";
    }
}